<!--
Copyright 2012 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE html><meta charset="UTF-8">
<style>
.animContainer {
  position: absolute;
  left: 0px;
}

.anim {
  left: 0px;
  width: 100px;
  height: 25px;
  background-color: #FAA;
  position: relative;
}

.expected {
  height: 25px;
  border-right: 1px solid black;
}

#ca {
  top: 50px;
  width: 280px;
}

#cb {
  top: 150px;
  width: 100px;
}

#cc {
  top: 250px;
  width: 100px;
}

#cd {
  top: 350px;
  width: 280px;
}
</style>

<div>Boxes in each group should line up with each other at end of each
iteration (or start if reversed).</div>
<div>Right edge of each box should align with black line at end of test.</div>

<div class="animContainer" id="ca">
  <div class="expected" style="width: 280px;"><div class="anim a" id="a"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim b" id="b"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim c" id="c"></div></div>
</div>

<div class="animContainer" id="cb">
  <div class="expected" style="width: 200px;"><div class="anim a" id="d"></div></div>
  <div class="expected" style="width: 200px;"><div class="anim b" id="e"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim c" id="f"></div></div>
</div>

<div class="animContainer" id="cc">
  <div class="expected" style="width: 200px;"><div class="anim a" id="g"></div></div>
  <div class="expected" style="width: 200px;"><div class="anim b" id="h"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim c" id="i"></div></div>
</div>

<div class="animContainer" id="cd">
  <div class="expected" style="width: 280px;"><div class="anim a" id="j"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim b" id="k"></div></div>
  <div class="expected" style="width: 280px;"><div class="anim c" id="l"></div></div>
</div>

<div style="height: 400px;"></div>

<script src="../bootstrap.js"></script>
<script>
"use strict";

var containers = ["ca", "cb", "cc", "cd"];

var directions = ["normal", "reverse", "alternate", "alternate-reverse"];

for (var i = 0; i < directions.length; i++) {
  var dir = directions[i];
  var container = document.getElementById(containers[i]);

  document.timeline.play(
      new AnimationGroup([
          // Test basic use.
          new Animation(container.getElementsByClassName("a")[0],
              [{left: "100px"}, {left: "300px"}],
              {duration: 1 * 1000, iterations: 3.4, fill: 'forwards'}),
          // Test integer iterations.
          new Animation(container.getElementsByClassName("b")[0],
              [{left: "100px"}, {left: "180px"}],
              {duration: 1 * 1000, iterations: 3.0, fill: 'forwards'}),
          // Test zero iterations.
          new Animation(container.getElementsByClassName("c")[0],
              [{left: "180px"}, {left: "300px"}],
              {duration: 1 * 1000, iterations: 0.0, fill: 'forwards'}),
          ], {iterations: 2, direction: dir, duration: 4 * 1000, fill: 'forwards'}));
}
</script>
